package com.hq.ims.data.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.hq.authority.utils.AppUtils;
import com.hq.ims.data.config.verification.VdAdd;
import com.hq.ims.data.config.verification.VdEdit;
import com.hq.ims.data.entity.BusiHistory;
import com.hq.ims.data.entityenum.*;
import com.hq.ims.data.vo.auth.BaseRowAuthVo;
import com.hq.utils.util.ListUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author 蒋柏平
 * @since 20241025
 */
@Mapper
public interface BusiHistoryMapstruct {

    BusiHistoryMapstruct INSTANCE = Mappers.getMapper(BusiHistoryMapstruct.class);

    //-------------------------------- 转换VO类 --------------------------------

    @Mappings({
    })
    BusiHistoryVo toBusiHistoryVo(BusiHistory source);

    default List<BusiHistoryVo> toBusiHistoryVoList(List<BusiHistory> source) {
        if (source == null) {
            return ListUtils.newEmptyList();
        }
        return source.stream().map(this::toBusiHistoryVo).collect(Collectors.toList());
    }

    //-------------------------------- 以下为自定义类[输出对象] --------------------------------

    @ApiModel(value = "原始对象的扩展类")
    @Data
    class BusiHistoryVo extends BusiHistory {

    }

    @ApiModel(value = "行级权限对象")
    @Data
    class BusiHistoryRowAuthVo extends BaseRowAuthVo {

        //自定义其它行级权限


        //构造函数
        public BusiHistoryRowAuthVo(BusiHistory entity) {
            //当前操作用户ID
            String userId = AppUtils.getUserId();
        }

    }


    //-------------------------------- 以下为自定义类[输入对象] --------------------------------

    @ApiModel(value = "搜索VO")
    @Data
    class PageSearchVo {

    }

    @ApiModel(value = "添加和修改对象")
    @Data
    class SaveVo {

        @NotBlank(message = "数据ID不能为空", groups = {VdEdit.class})
        @ApiModelProperty(value = "数据ID")
        private String busiHistoryId;

        @NotBlank(message = "经营信息管理ID不能为空", groups = {VdAdd.class, VdEdit.class})
        @Size(min = 1, max = 36, message = "经营信息管理ID长度不能超过36", groups = {VdAdd.class, VdEdit.class})
        @ApiModelProperty(value = "经营信息管理ID")
        private String busiInfoId;

        @ApiModelProperty(value = "重复率")
        private Double repetitionRate;

        @ApiModelProperty(value = "项目名称")
        private String projectName;

        @ApiModelProperty(value = "信息类型")
        private EnumBusinessTypeStatus infoType;

        @ApiModelProperty(value = "信息来源")
        private String infoSource;

        @ApiModelProperty(value = "项目地址名称")
        private String projectAddressName;

        @ApiModelProperty(value = "经度")
        private String longitude;

        @ApiModelProperty(value = "纬度")
        private String latitude;

        @ApiModelProperty(value = "项目阶段")
        private EnumProjectPhase projectStage;

        @ApiModelProperty(value = "省份")
        private String province;

        @ApiModelProperty(value = "省份编码")
        private String provinceCode;

        @ApiModelProperty(value = "城市")
        private String city;

        @ApiModelProperty(value = "市区编码")
        private String cityCode;

        @ApiModelProperty(value = "联系人")
        private String contactPerson;

        @ApiModelProperty(value = "联系方式")
        private String contactInfomation;

        @ApiModelProperty(value = "业主方公司名称")
        private String ownerCompanyName;

        @ApiModelProperty(value = "施工方公司名称")
        private String constructionName;

        @ApiModelProperty(value = "预计产值规模")
        private BigDecimal outputScale;

        @ApiModelProperty(value = "项目备注")
        private String projectRemark;

        @ApiModelProperty(value = "发布人")
        private String publisher;

        @ApiModelProperty(value = "发布人id")
        private String publisherId;

        @ApiModelProperty(value = "发布状态")
        private EnumPublishStatus publishStatus;

        @ApiModelProperty(value = "审核人")
        private String auditUserId;

        @ApiModelProperty(value = "发布时间")
        private LocalDateTime publishTime;

        @ApiModelProperty(value = "审核状态")
        private EnumAuditStatus auditStatus;

        @ApiModelProperty(value = "审批时间")
        private LocalDateTime auditTime;

        @ApiModelProperty(value = "审核备注")
        private String auditRemark;

        @ApiModelProperty(value = "接受状态")
        private EnumReceiveStatus acceptStatus;

        @ApiModelProperty(value = "组织机构ID")
        private String orgId;

        @ApiModelProperty(value = "组织机构名称")
        private String orgName;

        @ApiModelProperty(value = "父节点ID")
        private String parentId;

        @ApiModelProperty(value = "根节点ID")
        private String rootId;

        @ApiModelProperty(value = "产业标记")
        private String industryAssign;

        @ApiModelProperty(value = "企业分成规则")
        private BigDecimal companyDivideIntoRuleValue;

        @ApiModelProperty(value = "资金来源")
        private String fundingSource;

        @ApiModelProperty(value = "招标获取截止时间")
        private LocalDateTime tenderClosingDate;

        @ApiModelProperty(value = "招标截止时间")
        private LocalDateTime deadlineForBidding;

        @ApiModelProperty(value = "项目规模")
        private String projectScale;

        @ApiModelProperty(value = "工期要求")
        private String durationRequired;

        @ApiModelProperty(value = "招标范围")
        private String tenderScope;

        @ApiModelProperty(value = "资质要求")
        private String qualifications;

        @ApiModelProperty(value = "招标控制价")
        private BigDecimal tenderControlPrice;

        @ApiModelProperty(value = "保证金金额")
        private BigDecimal bond;

        @ApiModelProperty(value = "保证金缴纳截止时间")
        private LocalDateTime bondEndTime;

        @ApiModelProperty(value = "创建时间")
        private LocalDateTime createDateTime;

        @ApiModelProperty(value = "更新时间")
        private LocalDateTime updateDateTime;

        @ApiModelProperty(value = "是否删除")
        private Boolean isDel;

        @ApiModelProperty(value = "创建用户名称")
        private String createUserName;

        @ApiModelProperty(value = "更新用户名称")
        private String updateUserName;

        @ApiModelProperty(value = "乐观锁")
        private Integer version;


    }

    //-------------------------------- springboot验证标识 --------------------------------

}
